Portal = Ext.extend(Ext.util.Observable, {
	constructor: function(config){
		Ext.apply(this, config);
		Portal.superclass.constructor.call(this, config);
		this.init();
	}
	
	,init: function(){
		Ext.each(this.plugins, function(item, index, plugins){
			item.init(this);	
		}, this);
		
		var viewport = new Ext.Viewport({
			layout: 'border'
			,items: [
				this.getToolbar()
				,this.getView()
			]	
		});
	}
	
	,getToolbar: function(){
		if(this.__toolbar) return this.__toolbar;
		
		this.__toolbar = new Ext.Toolbar({
			region: 'north'
			,height: 85
			,border: false
			,defaults: {xtype: 'buttongroup', columns: 10}
			,items: [
				{
					title: 'Contents'
					,ref: 'btGroupContent'
					,items: [
						{
							iconCls: 'icon-panel-32x32'
							,text: 'Panel'
							,iconAlign: 'top'
							,scale: 'large'
							,ref: 'btPanel'	
						}
					]	
				}
			]
		});
		
		return this.__toolbar;
	}
	
	,getView: function(){
		if(this.__view) return this.__view;
		
		var html = 
			'<div id="container">'
				+ '<div id="header"></div>'
				+ '<div id="menu"></div>'
				+ '<div id="column-container">'
					+ '<div id="column1" class="column"></div>'
					+ '<div id="column2" class="column"></div>'
					+ '<div id="column3" class="column"></div>'
					+ '<div class="clearing"></div>'
				+ '</div>'
				+ '<div id="footer"></div>'
			+ '</div>';
		
		
		this.__view = new Ext.Panel({
			region: 'center'
			,html: html
			,border: false
			,autoScroll: true
			,bodyStyle: 'padding-top:10px;'
			,listeners: {
				afterrender: function(panel){
					var columns = panel.el.select('div.column');
					columns.each(function(el, c, index){
						var dt = new Ext.dd.DropTarget(el.id, {
							ddGroup: 'column' + index
							,notifyDrop: function(ds, e, data){
								return true;	
							}
							,notifyOver: function(ds, e, data){
								
							}
						});
						dt.addToGroup('column');
					});
				}
			}
		});
		
		return this.__view;	
	}
});